package view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.net.URL;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class AddFolderDialog extends JDialog {


	private static final long serialVersionUID = 1L;

	
	int MAX = 10;
	
	public JTextArea infoText = new JTextArea();
	public JTextField ordnerName = new JTextField(MAX);
	URL saveFolderURL  =  getClass().getResource("/images/save.png");
	public JButton anlegen = new JButton(new ImageIcon (saveFolderURL));

	
	public AddFolderDialog(JFrame frame) {
		super(frame, "Ordner anlegen", true);
		
		 JPanel panel = new JPanel(new GridBagLayout());
		 panel.setBackground(new Color(243, 243, 130));
		 panel.setVisible(true);
		 this.add(panel);
		 
	     GridBagConstraints cs = new GridBagConstraints();
	     cs.fill = GridBagConstraints.HORIZONTAL;
	     
	    infoText.setText("Ordner-Name (maximal 10 Zeichen)");
	    infoText.setFont(new Font("Arial", Font.BOLD, 30));
	    infoText.setEditable(false);
	    infoText.setBackground(new Color(243, 243, 130));
	    
		cs.gridx = 0;
		cs.gridy = 0;
		cs.gridwidth = 1;
		cs.gridheight = 10;
		cs.insets = new Insets(10, 10, 10, 10);
		panel.add(infoText);
						
		ordnerName.setPreferredSize(new Dimension(120,20));
		ordnerName.setBackground(new Color(243, 243, 130));
		ordnerName.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		ordnerName.setDocument(new TextDoc(MAX)); 
		
		cs.gridx = 0;
		cs.gridy = 1;
		cs.gridwidth = 1;
		
		panel.add(ordnerName, cs);
		
		
		anlegen.setBounds(50, 20, 25, 32);
		anlegen.setVisible(true);
		anlegen.setBorder(null);
		anlegen.setBackground(new Color(243, 243, 130));
		anlegen.setToolTipText("Ordner anlegen");
		
		cs.gridx = 1;
		cs.gridy = 1;
		cs.gridwidth = 1;
		
		panel.add(anlegen ,cs );
		setSize(new Dimension(600,180));
		setLocationRelativeTo(frame);

		
	}
}
